home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1101 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: news.lpr.carel.fi!usenet
  2. From: aril@cmt.lpr.mail.carel.fi (Ari Lukumies)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: stricmp()
  5. Date: Thu, 11 Jan 1996 13:02:32 GMT
  6. Organization: Carelcomp Forest Oy
  7. Message-ID: <4d325o$kdv@tahko.lpr.carel.fi>
  8. References: <8213293982604@demosys.gcomm.com>
  9. NNTP-Posting-Host: renoir.cclahti.carel.fi
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. jackal@gcomm.com (Jack Alvrus) wrote:
  13.  
  14.  
  15. >Here's a fun question for ya':
  16.  
  17. >stricmp() is an ANSI library function, right?  So it should exhibit, if
  18. >not consistent, at least *documented* behavior, right?
  19.  
  20. >So, is stricmp("a","^") always less than zero or greater than zero, and
  21. >if neither, is there any documented behavior in this case?
  22.  
  23. >I ask because '^' is *between* 'A' and 'a' in ASCII.  So if stricmp()
  24. >always compares to upper case letters, stricmp("a","^") is always less
  25. >than zero.  If it always compares to lower case letters,
  26. >stricmp("a","^") is always *greater* than zero.
  27.  
  28. >My compiler's reference manual does not say one way or another, but a
  29. >quick test showed stricmp("a","^") < 0.
  30.  
  31. >Any comments?
  32.  
  33. > Jack Alvrus
  34. > Galacticomm Software Engineer
  35.  
  36. To my knowledge, stricmp _is_ one of the ANSI functions. However, the
  37. string comparison functions also depend on locality to correctly
  38. compare characters. Comparing anything than alphabets, however, is
  39. implementation-dependant, and as such, information about how it's done
  40. should be found in your compiler's manuals implementation details
  41. section.
  42.  
  43.  AriL
  44.  
  45. All my opinions are mine and mine alone.
  46.  
  47.